/*
    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

*/

#include "raymatrix.h"
#include "cgpanel/raytracer/ray.h"
#include <QVector>
#include <iostream>
using namespace std;

namespace draw {

  RayMatrix::RayMatrix(int rows, int cols):m_rows(rows),m_cols(cols){
    for(int i = 0; i < rows; ++i){
      m_matrix.push_back(new QVector<Ray*>());
      for(int j = 0; j < cols; ++j)
        m_matrix.at(i)->push_back(new Ray());       
    }    
  }
  
  RayMatrix::~RayMatrix(){
    m_matrix.clear();
  }
  
void RayMatrix::setRay(int r, int c, object::Vertex * org, object::Vertex * end)
{
  //cout << "rows: " << m_matrix.size() << "--" << r << endl;
  //cout << "cols: " << m_matrix.at(r)->size() << "--" << c << endl;
  
  m_matrix.at(r)->at(c)->init(org, end);
}
  
};
